<template>
  <view class="test">
    <input type="text" v-model="formData.mobile" placeholder="手机号" />
    <input type="text" v-model="formData.password" placeholder="密码" />
    <button @tap="getTestData">测试请求</button>
    <button @tap="getMobileCode">获取验证码</button>

    <view>{{ store }}</view>

    <text>数量：{{ store.count }}, 双倍：{{ store.double }}</text>
    <button size="mini" type="default" @tap="store.decrement()">-</button>

    <button size="mini" @tap="store.increment()">+</button>
  </view>
</template>

<script lang="ts" setup>
import { getCodeAPI, postLoginPasswordAPI } from "@/apis/common";
import { useCounterStore } from "@/stores/counter";
import type { PostLoginPasswordParams } from "@/types/common";
import { ref } from "vue";

const store = useCounterStore();

export interface LoginData {
  /**
   * 用户名
   */
  account?: string;
  /**
   * 头像
   */
  avatar?: string;
  /**
   * 用户id
   */
  id?: string;
  /**
   * 脱敏手机号，带星号的手机号
   */
  mobile?: string;
  /**
   * refreshToken
   */
  refreshToken: string;
  /**
   * token
   */
  token: string;
}

const formData = ref<PostLoginPasswordParams>({
  mobile: "13230000001",
  password: "abc12345",
});
const getTestData = async () => {
  const res = await postLoginPasswordAPI(formData.value);
  console.log(res);
};

const getMobileCode = async () => {
  const res = await getCodeAPI({
    mobile: formData.value.mobile,
    type: "login",
  });

  console.log(res);
};
</script>

<style lang="scss"></style>
